﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.IO;



namespace swfTools
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("转换中...");
            bool result = PDFToSWF("C://Program Files (x86)/SWFTools/pdf2swf.exe", "F://123综合文件/pdf1234.pdf", "C://PDF/2.swf");
            if (result)
            {
                Console.WriteLine("转换成功");
            }
            else
            {
                Console.WriteLine("转换失败");
            }
            Console.ReadKey();
        }

        public static bool PDFToSWF(string toolPah, string sourcePath, string targetPath)
        {
            Process pc = new Process();
            bool result = false;

            string cmd = toolPah;
            if (File.Exists(sourcePath))
            {
                string args = " -t " + sourcePath + " -s flashversion=9 -o " + targetPath;
                try
                {
                    ProcessStartInfo psi = new ProcessStartInfo(cmd, args);
                    psi.WindowStyle = ProcessWindowStyle.Hidden;
                    pc.StartInfo = psi;
                    pc.Start();
                    pc.WaitForExit();
                    result = true;
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    pc.Close();
                    pc.Dispose();
                }
            }
            return result;
        }

        public static void Dwg2Pdf()
        {
            
        }
    }
}
